﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CrossGenLogic
{
    public class CharWithCount
    {
        private char _char;
        private int count;
        internal CharWithCount(char _char, int count)
        {
            this._char = _char;
            this.count = count;
        }
        internal CharWithCount()
        {
            this._char = ' ';
            this.count = 0;
        }
        public char Char
        {
            get 
            { 
                return _char; 
            }
            set
            {
                IncreaseCount();
                _char = value;
            }
        }
        public void IncreaseCount()
        {
            count++;
        }
        public void DecreaseCount()
        {
            if (count > 0)
            {
                if (--count == 0) _char = ' ';
            }
        }
    }
}
